//
//  ChooseLab.m
//  HubeiHotel
//
//  Created by LiBenCan on 17/11/23.
//  Copyright © 2017年 张露杰. All rights reserved.
//

#import "ChooseLab.h"

@implementation ChooseLab

- (instancetype)initWithFrame:(CGRect)frame textAligment:(NSInteger)aligment font:(CGFloat)font textColor:(NSString *)textColor text:(NSString *)text
{
    if (self = [super initWithFrame:frame]) {
        self.userInteractionEnabled = YES;
        self.textAlignment = aligment;
        self.font = [UIFont systemFontOfSize:font];
        self.textColor = [UIColor colorWithHexString:textColor];
        self.text = text;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(LabTap)];
        [self addGestureRecognizer:tap];
        [self.layer setCornerRadius:3*screenW_6];
        self.layer.masksToBounds = YES;
        self.layer.borderWidth = 1;
        self.layer.borderColor = [[UIColor colorWithHexString:@"#DBDBDB"] CGColor];
    }
    return self;
}
- (void)LabTap
{
    if (_block) {//存在则点击回调
        _block(self);
    }
}
-(void)selectLab//选中的颜色
{
    self.textColor =[UIColor colorWithHexString:@"#4abebb"];
    self.layer.borderColor = [[UIColor colorWithHexString:@"#4bbfbc"] CGColor];
}
-(void)unSelectLab//非选中的角色
{
    self.textColor =[UIColor colorWithHexString:@"#666666"];
    self.layer.borderColor =[[UIColor colorWithHexString:@"#DBDBDB"] CGColor];
}
@end
